import http from './index'

// 获取列表
export const getlist=()=>http.get('/api/list')

// 搜索接口
export interface SearchParams {
  pageCode?: string
  pageSize?: string
  searchValue?: string
}

export interface SearchResult {
  // 根据实际API返回结构定义
  id: string
  title: string
  content: string
  // 其他字段根据实际API调整
}

export interface SearchResponse {
  code: number
  message: string
  data: {
    list: SearchResult[]
    total: number
    pageCode: number
    pageSize: number
  }
}

export const searchApi = (params: SearchParams) => {
  return http.get<SearchResponse>('/search', { params })
}

// 个人信息相关接口
export interface UserInfo {
  id: string
  name: string
  relation: string
  phone: string
  idCard: string
  isMain: boolean
  avatar?: string
}

export interface UserListResponse {
  code: number
  message: string
  data: UserInfo[]
}

// 获取个人信息列表
export const getUserList = () => {
  return http.get<UserListResponse>('/user/list')
}